package com.jial08.designpatterns.factory.abst;

import com.jial08.designpatterns.factory.abst.color.Color;
import com.jial08.designpatterns.factory.abst.shape.Shape;

/**
 * <p>类描述：。</p>
 *
 * @author jl
 * @version v1.0.0.1。
 * @since JDK1.8。
 * <p>创建日期：2019/10/14 上午9:37。</p>
 */
public class Demo {
	public static void main(String[] args) {
		AbstractFactory abstractFactory = FactoryProducer.getFactory("shape");
		if (abstractFactory != null) {
			Shape circle = abstractFactory.getShape("circle");
			if (circle != null) {
				circle.draw();
			}
		}

		abstractFactory = FactoryProducer.getFactory("color");
		if (abstractFactory != null) {
			Color color = abstractFactory.getColor("red");
			if (color != null) {
				color.fill();
			}
		}
	}
}
